package com.bawei.common.mvi

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.blankj.utilcode.util.ToastUtils


/**
 * 作者：Jason
 * 日期：2023/11/16
 * 描述：基类Activity
 */

abstract class BaseActivity<VDB : ViewDataBinding> : AppCompatActivity() {

    lateinit var mDataBinding: VDB

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mDataBinding = DataBindingUtil.setContentView(this, getLayoutId())
        initViews()
        initData()
        updateUI()
    }

    fun showToastMessage(msg: String) {
        if (!msg.isNullOrEmpty()) {
            ToastUtils.showLong(msg)
        }
    }

    abstract fun getLayoutId(): Int
    abstract fun initViews()
    abstract fun initData()
    abstract fun updateUI()

}